function intPart(floatNum) {
	if (floatNum < -0.0000001) {
		return Math.ceil(floatNum - 0.0000001)
	}
	return Math.floor(floatNum + 0.0000001)
}
function meses(mes) {
	if (mes == 1) {
		return "Muharram"
	}
	if (mes == 2) {
		return "Safar"
	}
	if (mes == 3) {
		return "Rabi I"
	}
	if (mes == 4) {
		return "Rabi II"
	}
	if (mes == 5) {
		return "Jumada I"
	}
	if (mes == 6) {
		return "Jumada II"
	}
	if (mes == 7) {
		return "Rajab"
	}
	if (mes == 8) {
		return "Sha'ban"
	}
	if (mes == 9) {
		return "Ramadan"
	}
	if (mes == 10) {
		return "Shawwal"
	}
	if (mes == 11) {
		return "Dhu'l-Qa'dah"
	}
	if (mes == 12) {
		return "Dhu'l-Hijja"
	}
	return ""
}

function fechaislamica(d, m, y) {
	// var now = new Date();
	// d=now.getDate();
	// m=now.getMonth()+1
	// y=now.getYear()
	if ((y > 1582) || ((y == 1582) && (m > 10))
			|| ((y == 1582) && (m == 10) && (d > 14))) {
		jd = intPart((1461 * (y + 4800 + intPart((m - 14) / 12))) / 4)
				+ intPart((367 * (m - 2 - 12 * (intPart((m - 14) / 12)))) / 12)
				- intPart((3 * (intPart((y + 4900 + intPart((m - 14) / 12)) / 100))) / 4)
				+ d - 32075
	} else {
		jd = 367 * y - intPart((7 * (y + 5001 + intPart((m - 9) / 7))) / 4)
				+ intPart((275 * m) / 9) + d + 1729777
	}
	l = jd - 1948440 + 10632
	n = intPart((l - 1) / 10631)
	l = l - 10631 * n + 354
	j = (intPart((10985 - l) / 5316)) * (intPart((50 * l) / 17719))
			+ (intPart(l / 5670)) * (intPart((43 * l) / 15238))
	l = l - (intPart((30 - j) / 15)) * (intPart((17719 * j) / 50))
			- (intPart(j / 16)) * (intPart((15238 * j) / 43)) + 29
	m = intPart((24 * l) / 709)
	d = l - intPart((709 * m) / 24)
	y = 30 * n + j - 30

	document.write(d + " " + meses(m) + " " + y);
}

function fechaislamica() {
	var now = new Date();
	d = now.getDate();
	m = now.getMonth() + 1
	y = now.getFullYear()
	if ((y > 1582) || ((y == 1582) && (m > 10))
			|| ((y == 1582) && (m == 10) && (d > 14))) {
		jd = intPart((1461 * (y + 4800 + intPart((m - 14) / 12))) / 4)
				+ intPart((367 * (m - 2 - 12 * (intPart((m - 14) / 12)))) / 12)
				- intPart((3 * (intPart((y + 4900 + intPart((m - 14) / 12)) / 100))) / 4)
				+ d - 32075
	} else {
		jd = 367 * y - intPart((7 * (y + 5001 + intPart((m - 9) / 7))) / 4)
				+ intPart((275 * m) / 9) + d + 1729777
	}
	l = jd - 1948440 + 10632
	n = intPart((l - 1) / 10631)
	l = l - 10631 * n + 354
	j = (intPart((10985 - l) / 5316)) * (intPart((50 * l) / 17719))
			+ (intPart(l / 5670)) * (intPart((43 * l) / 15238))
	l = l - (intPart((30 - j) / 15)) * (intPart((17719 * j) / 50))
			- (intPart(j / 16)) * (intPart((15238 * j) / 43)) + 29
	m = intPart((24 * l) / 709)
	d = l - intPart((709 * m) / 24)
	y = 30 * n + j - 30

	document.write(d + " " + meses(m) + " " + y);
}

function fecha(now) {
	var now = new Date();
	var months = new Array('Gener', 'Febrer', 'Març', 'Abril', 'Maig', 'Juny',
			'Juliol', 'Agost', 'Setembre', 'Octubre', 'Novembre', 'Desembre');
	// var date = ((now.getDate()<10) ? "0" : "")+ now.getDate();
	function fourdigits(number) {
		return (number < 1000) ? number + 1900 : number;
	}
	today = now.getDate() + " de " + months[now.getMonth()] + " de "
			+ (fourdigits(now.getYear()));
	document.write(today);
}

function diasemana(ndia) {
	ndia = ndia - 1
	var diasemana = new Array('Diumenge', 'Dilluns', 'Dimarts', 'Dimecres',
			'Dijous', 'Divendres', 'Dissabte');
	document.write(diasemana[ndia]);
}

function diasemana() {
	var now = new Date();
	var ndia = now.getDay();
	var diasemana = new Array('Diumenge', 'Dilluns', 'Dimarts', 'Dimecres',
			'Dijous', 'Divendres', 'Dissabte');
	document.write(diasemana[ndia]);
}

function hora() {
	var now = new Date();
	document.write(now.getHours() + ':' + now.getMinutes());
}

function stripHTML(txt) {
	return txt.replace(/<\S[^><]*>/g, "");
}

function addFavoritosMarcadores() {
	title = "Consell Islàmic Cultural de Catalunya";
	url = "http://www.consellislamic.org";
	if (window.sidebar) { // Mozilla Firefox Bookmark
		window.sidebar.addPanel(title, url, "");
	} else if (window.external) { // IE Favorite
		window.external.AddFavorite(url, title);
	} else if (window.opera && window.print) { // Opera Hotlist
		return true;
	}
}